/* Copyright Rex All rights reserved. */
enyo.kind({
	name: "com.RexToy.wghtView",
	kind: com.RexToy.abstractCvtView,
	components:[
		{kind: "BasicScroller", components: [
			{kind: "RowGroup", components: [				
				{name: "kg", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Kg")}
						]},
				{name: "g", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Gram")}
						]},
				{name: "t", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Ton")}
						]},
				{name: "oz", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Ounce")}
						]},
				{name: "lb", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Pound")}
						]},				
				{name: "ozt", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Troy Ounces")}
						]},
				{name: "lbt", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Troy Pounds")}
						]},
				{name: "j", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Jin(China)")}
						]},						
				{name: "l", richContent: false, kind: "Input", onblur:"blur", components: [
							{className: "hint", content: $L("Liang(China)")}
						]}
						
			]}
		]}
	],
	
	fomular: {
		"g->g": "g",
		
		"g->kg": "g/1000",
		"kg->g": "kg*1000",
		"g->t": "g/1000000",
		"t->g": "t*1000000",
		"g->oz": "g*0.035274",
		"oz->g": "oz/0.035274",
		"g->lb": "g*0.0022046",
		"lb->g": "lb/0.0022046",
		"g->ozt": "g*0.0321507",
		"ozt->g": "ozt/0.0321507",
		"g->lbt": "g*0.0026792",
		"lbt->g": "lbt/0.0026792",
		
		"g->l": "g*0.02",
		"l->g":	"l/0.02",
		"g->j": "g*0.002",
		"j->g": "j/0.002"
	},
	
	units: ["kg","g","t","oz","lb","ozt","lbt","j","l"],
	baseUnit: "g",
	
	blur: function(sender)
	{
		if(this.isNumber(sender))
		{
			this.calc(sender.name, this.getNumber(sender));
		}
	}
});